/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package it.polimi.deib.se2.meteocal.gui;

import it.polimi.deib.se2.meteocal.business.boundary.UserManager;
import it.polimi.deib.se2.meteocal.business.entity.User;
import java.io.Serializable;
import javax.ejb.EJB;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;

@Named
@SessionScoped
public class UserBean implements Serializable {
    private static final long serialVersionUID = 1L;
    private int numberNotifications;
    
    @EJB
    UserManager um;
    
    public UserBean() {
    }
    
    public String getName() {
        return um.getLoggedUser().getName();
    }
    
    public String getEmail() {
        return um.getLoggedUser().getEmail();
    }
    
    public User getUser() {
        return um.getLoggedUser();
    }
    
    public int getNumberNotifications(){
        numberNotifications = um.getLoggedUser().getNotifications().size();
        return numberNotifications;
    }
    
    public void setNumberNotifications(int numberNotifications){
        this.numberNotifications = numberNotifications;
    }
}